package edu.uwlax.cs.oayonlinestore.client;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.ServiceDefTarget;

import edu.uwlax.cs.oayonlinestore.exceptions.SerializableException;
import com.google.gwt.user.client.rpc.AsyncCallback;

public interface OnlinestoreRServiceAsync {

	/**
	 * <p>
	 * If the categoryID from the Category-object is the id of an existing
	 * Category in the database, the database is updated. If the categoryID is
	 * zero, the Category-object is inserted as a new entry in the database.
	 * </p>
	 */
	public void addEditCategory(
			edu.uwlax.cs.oayonlinestore.vo.CategoryVO category, AsyncCallback callback);

	/**
	 * <p>
	 * Adds or modifies a product. If the productID of the product-object is
	 * zero, a new product is created for the specified subcategory. Otherwise,
	 * if the productID of the product-object specifies a valid existing
	 * product, this product is updated and subcategoryID is ignored.
	 * </p>
	 */
	public void addEditProduct(
			edu.uwlax.cs.oayonlinestore.vo.ProductDetailsVO product,
			int subcategoryID, AsyncCallback callback);

	/**
	 * <p>
	 * Adds or edits a RetEx Form. If the id of the reExForm-object is zero, a
	 * new RetExForm is created. Otherwise, the approriate existing RetExForm is
	 * updated.
	 * </p>
	 */
	public void addEditRetExForm(
			edu.uwlax.cs.oayonlinestore.vo.RetExFormVO retExForm,
			int orderItemID, AsyncCallback callback);

	/**
	 * <p>
	 * Adds or modifies a Subcategory. If the id of the subcategory-object is
	 * zero, a new subcategory is created within the specified category.
	 * Otherwise, if the id is non-zero, specified existing category is updated.
	 * </p>
	 */
	public void addEditSubcategory(
			edu.uwlax.cs.oayonlinestore.vo.SubcategoryVO subcategory,
			int categoryID, AsyncCallback callback);

	/**
	 * <p>
	 * If the passed User-object contains a valid userID, the corresponding user
	 * is updated in the database. If the userID of the User-object is zero, a
	 * new user is created in the database.
	 * </p>
	 */
	public void addEditUser(edu.uwlax.cs.oayonlinestore.vo.UserDetailsVO user, AsyncCallback callback);

	/**
	 * <p>
	 * Adds a giftcard to an order.
	 * </p>
	 * <p>
	 * Uses Order->addGiftCard()
	 * </p>
	 */
	public void addGiftCardToOrder(int orderID, java.lang.String cardID, AsyncCallback callback);

	/**
	 * <p>
	 * Adds the user as a manager to the specified category.
	 * </p>
	 * <p>
	 * Uses Category->addManager(manager)
	 * </p>
	 */
	public void addManagerToCategory(int categoryID, int userID, AsyncCallback callback);

	/**
	 * <p>
	 * Adds a product to the shopping cart.
	 * </p>
	 * <p>
	 * Uses OrderItem->initByProduct(product, quantity)
	 * </p>
	 * <p>
	 * and Order->addOrderItem(orderItem)
	 * </p>
	 */
	public void addProductToOrder(int productID, int quantity, int orderID, AsyncCallback callback);

	/**
	 * <p>
	 * Adds the user to the list of staff members of the specified category.
	 * </p>
	 * <p>
	 * Uses Category->removeStaff(staff)
	 * </p>
	 */
	public void addStaffToCategory(int categoryID, int userID, AsyncCallback callback);

	/**
	 * <p>
	 * sets the flag isIndustrialUser to true for the user identified by the
	 * userID
	 * </p>
	 * <p>
	 * Uses User->approveIndustrialUser()
	 * </p>
	 */
	public void approveIndustrialUser(int userID, AsyncCallback callback);

	/**
	 * 
	 */
	public void createSnapshot(AsyncCallback callback);

	/**
	 * <p>
	 * Deletes the specified GiftCard.
	 * </p>
	 */
	public void deleteGiftCard(int giftCardID, AsyncCallback callback);

	/**
	 * <p>
	 * Removes an orderitem from an order.
	 * </p>
	 * <p>
	 * Uses Order->removeOrderItem(orderItem)
	 * </p>
	 */
	public void deleteOrderItem(int orderItemID, AsyncCallback callback);

	/**
	 * <p>
	 * Sets the isActive flag for a category to false.
	 * </p>
	 */
	public void disableCategory(int categoryID, AsyncCallback callback);

	/**
	 * <p>
	 * Sets the isActive flag to false for a product. Products that are not
	 * active anymore are not not displayed to the customer nor can he buy it.
	 * But they may appear in sales and inventory reports and retex forms.
	 * </p>
	 */
	public void disableProduct(int productID, AsyncCallback callback);

	/**
	 * <p>
	 * Sets the isActive Flag for a subcategory to false.
	 * </p>
	 */
	public void disableSubcategory(int subcategoryID, AsyncCallback callback);

	/**
	 * <p>
	 * Generates count GiftCards with the specified moneyValue. The cardID of
	 * the gift-card is generated as a random string.
	 * </p>
	 * <p>
	 * Uses GiftCard->generateCodeID()
	 * </p>
	 */
	public void generateGiftCards(int count, int moneyValue, AsyncCallback callback);

	/**
	 * 
	 */
	public void generateTestData(AsyncCallback callback);

	/**
	 * <p>
	 * Returns a list of all users for which isIdustrialCustomer is true an
	 * which are not activated
	 * </p>
	 */
	public void getApprovableIndustrialUsers(AsyncCallback callback);

	/**
	 * <p>
	 * Returns the single Category-object identified by categoryID from the
	 * database.
	 * </p>
	 */
	public void getCategory(int categoryID, AsyncCallback callback);

	/**
	 * <p>
	 * Returns a list of all categories avaliable in the database.
	 * </p>
	 */
	public void getCategoryList(AsyncCallback callback);

	/**
	 * <p>
	 * Returns all Users that are managers of the category specified by
	 * categoryID.
	 * </p>
	 */
	public void getCategoryManagerList(
			int categoryID, AsyncCallback callback);

	/**
	 * <p>
	 * Returns a list of all users for which the flag canBeCategoryPerson is
	 * true.
	 * </p>
	 */
	public void getCategoryPeopleList(AsyncCallback callback);

	/**
	 * <p>
	 * Returns a list of all users that are staff members for the specified
	 * category.
	 * </p>
	 */
	public void getCategoryStaffList(
			int categoryID, AsyncCallback callback);

	/**
	 * <p>
	 * Returns a list of all categories and every category contains a list of
	 * its subcategories.
	 * </p>
	 */
	public void getCategoryStructureList(AsyncCallback callback);

	/**
	 * <p>
	 * Returns the order of the user that is currently logged in if userID is
	 * zero
	 * </p>
	 * <p>
	 * Uses Session->getOrder()
	 * </p>
	 */
	public void getCurrentOrder(AsyncCallback callback);

	/**
	 * <p>
	 * Returns a list of all categories that the currently logged in
	 * category-manager/staff can manage.
	 * </p>
	 */
	public void getEditableCategoriesForCurrentUser(AsyncCallback callback);

	/**
	 * <p>
	 * Returns a List of all GiftCards
	 * </p>
	 */
	public void getGiftCardList(AsyncCallback callback);

	/**
	 * <p>
	 * Returns the inventory report for the specified day.
	 * </p>
	 */
	public void getInventoryReport(
			int snapshot1ID, int snapshot2ID, AsyncCallback callback);

	/**
	 * <p>
	 * returns Session->getUser()
	 * </p>
	 */
	public void getLoggedInUser(AsyncCallback callback);

	/**
	 * <p>
	 * Returns all the information from an order that can directly be edited by
	 * the user.
	 * </p>
	 */
	public void getOrderEdit(int orderID, AsyncCallback callback);

	/**
	 * <p>
	 * Returns extended info about order which consits of all the order-related
	 * information that can not be directly edited by the user.
	 * </p>
	 */
	public void getOrderExtended(
			int orderID, AsyncCallback callback);

	public void getOrdersByLastNameAndZip(
			java.lang.String lastname, int zip, AsyncCallback callback);

	/**
	 * <p>
	 * Returns a list of all orders for the specified user. If orderID is zero,
	 * all orders are returned.
	 * </p>
	 */
	public void getOrderSummaryList(
			int userID, AsyncCallback callback);

	/**
	 * <p>
	 * Returns a list of all products for the specified subcategory.
	 * </p>
	 */
	public void getProductDetailList(
			int subcategoryID, AsyncCallback callback);

	/**
	 * 
	 */
	public void getRetExForm(int formID, AsyncCallback callback);

	/**
	 * <p>
	 * Returns a list of all RetExForms.
	 * </p>
	 */
	public void getRetExFormsList(AsyncCallback callback);

	/**
	 * <p>
	 * Returns the sales report for the specified day.
	 * </p>
	 */
	public void getSalesReport(
			java.util.Date date, AsyncCallback callback);

	/**
	 * 
	 */
	public void getSnapshotList(AsyncCallback callback);

	/**
	 * <p>
	 * Returns the list of all subcategories for the specified category.
	 * </p>
	 */
	public void getSubcategories(
			int categoryID, AsyncCallback callback);

	/**
	 * <p>
	 * Returns the User-object from the database that is specified by the userID
	 * </p>
	 */
	public void getUserDetail(int userID, AsyncCallback callback);

	/**
	 * <p>
	 * returns a list of all users in the database
	 * </p>
	 */
	public void getUserDetailList(AsyncCallback callback);

	/**
	 * <p>
	 * uses Session->login(login, pwd)
	 * </p>
	 */
	public void login(
			java.lang.String login, java.lang.String pwd, AsyncCallback callback);

	/**
	 * <p>
	 * Uses Session->logout()
	 * </p>
	 */
	public void logout(AsyncCallback callback);

	/**
	 * 
	 */
	public void placeOrder(int orderID, AsyncCallback callback);

	/**
	 * <p>
	 * removes a giftcard from an order.
	 * </p>
	 * <p>
	 * Uses Order->removeGiftCard
	 * </p>
	 */
	public void removeGiftCardFromOrder(int orderID, int giftCardID, AsyncCallback callback);

	/**
	 * <p>
	 * Removes the user from the list of managers of the specified category.
	 * </p>
	 * <p>
	 * Uses Category->removeManager(manager)
	 * </p>
	 */
	public void removeManagerFromCategory(int categoryID, int userID, AsyncCallback callback);

	/**
	 * <p>
	 * Removes the specified user from the list of staff members from the
	 * specified category.
	 * </p>
	 * <p>
	 * Uses Category->removeStaff(staff)
	 * </p>
	 */
	public void removeStaffFromCategory(int categoryID, int userID, AsyncCallback callback);

	/**
	 * 
	 */
	public void setCurrentOrder(int orderID, AsyncCallback callback);

	/**
	 * <p>
	 * Sets the amount for an orderitem.
	 * </p>
	 */
	public void setOrderItemAmount(int orderItemID, int ammount, AsyncCallback callback);

	public void setProductPrices(
			edu.uwlax.cs.oayonlinestore.vo.ProductPriceVO product, AsyncCallback callback);

	/**
	 * <p>
	 * sets isActive and isIndustrialCustomer to false for this user
	 * </p>
	 */
	public void setUserInactive(int userID, AsyncCallback callback);

	/**
	 * <p>
	 * Saves the order-related information that can be directly edited by the
	 * user or a sales person.
	 * </p>
	 * <p>
	 * It consists of shipping, billing and payment related information.
	 * </p>
	 */
	public void updateOrderEdit(
			edu.uwlax.cs.oayonlinestore.vo.OrderEditVO orderEdit,
			boolean storeCCInProfile, AsyncCallback callback);
}
